Skip to content

[stubtest] Respect @final runtime decorator, enforce it in stubs#14922

Merged
sobolevn merged 2 commits intopython:masterfrom
sobolevn:issue-14921
Mar 19, 2023
Merged

[stubtest] Respect @final runtime decorator, enforce it in stubs#14922
sobolevn merged 2 commits intopython:masterfrom
sobolevn:issue-14921

Conversation

@sobolevn
Copy link
Copy Markdown
Member

Closes #14921

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice idea! Should we do the same for @typing(_extensions).override?

Copy link
Copy Markdown
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also:

  • Methods can also be decorated with @final/@override, maybe we should also verify those in the same way?
  • We should add a comment next to this line, saying that we give a specialised error for classes decorated with @final elsewhere:
    "__final__",

Comment thread mypy/stubtest.py Outdated
@sobolevn
Copy link
Copy Markdown
Member Author

sobolevn commented Mar 19, 2023

@AlexWaygood I don't see much value in @override decorator support, but I guess it is kinda easy to add. So, why not?

I will also work on @final decorator support on methods in the next PR. Nice idea!

Thanks a lot for the review, I am going to merge this when the CI is green 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Source code that has @final decorator does not require @final in stub

3 participants